home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / machine / atari_vg.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  1KB  |  65 lines

  1. /***************************************************************************
  2.  
  3.   machine.c
  4.  
  5.   Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
  6.   I/O ports)
  7.  
  8. ***************************************************************************/
  9.  
  10. #include "driver.h"
  11.  
  12. #define EAROM_SIZE    0x40
  13.  
  14. static int earom_offset;
  15. static int earom_data;
  16. static char earom[EAROM_SIZE];
  17.  
  18. READ_HANDLER( atari_vg_earom_r )
  19. {
  20.     logerror("read earom: %02x(%02x):%02x\n", earom_offset, offset, earom_data);
  21.     return (earom_data);
  22. }
  23.  
  24. WRITE_HANDLER( atari_vg_earom_w )
  25. {
  26.     logerror("write earom: %02x:%02x\n", offset, data);
  27.     earom_offset = offset;
  28.     earom_data = data;
  29. }
  30.  
  31. /* 0,8 and 14 get written to this location, too.
  32.  * Don't know what they do exactly
  33.  */
  34. WRITE_HANDLER( atari_vg_earom_ctrl_w )
  35. {
  36.     logerror("earom ctrl: %02x:%02x\n",offset, data);
  37.     /*
  38.         0x01 = clock
  39.         0x02 = set data latch? - writes only (not always)
  40.         0x04 = write mode? - writes only
  41.         0x08 = set addr latch?
  42.     */
  43.     if (data & 0x01)
  44.         earom_data = earom[earom_offset];
  45.     if ((data & 0x0c) == 0x0c)
  46.     {
  47.         earom[earom_offset]=earom_data;
  48.         logerror("    written %02x:%02x\n", earom_offset, earom_data);
  49.     }
  50. }
  51.  
  52.  
  53. void atari_vg_earom_handler(void *file,int read_or_write)
  54. {
  55.     if (read_or_write)
  56.         osd_fwrite(file,earom,EAROM_SIZE);
  57.     else
  58.     {
  59.         if (file)
  60.             osd_fread(file,earom,EAROM_SIZE);
  61.         else
  62.             memset(earom,0,EAROM_SIZE);
  63.     }
  64. }
  65.